$(function(){
	
	var vm = new Vue({
		el:'#Main',
		data:{
			//优惠券福利
			wealData:testData.weal,
		},
		methods:{
			
			//收放优惠券详情
			controlRuler:function(e){
				var node = e.currentTarget.children;
				if(node[1].className.indexOf('active') < 0){
					//展开
					node[0].className = 'flex-full ruler animate';
					node[1].className = 'btn animate active';
				}else{
					//收起
					node[0].className = 'flex-full ruler animate dm-wrap';
					node[1].className = 'btn animate';
				};
			},
			
			//领取优惠券
			pullWeal:function(wealId){
				var that = this;
				dmAlert('领取成功，去商场好好逛逛吧~',{
					cancel:'再等会',
					enter:'去商城',
					success:function(){
						location.href = 'mall.html';
					}
				});
				for(i in that.wealData){
					if(that.wealData[i].id == wealId){
						that.wealData[i].statu = 1; 
					};
				};
			},
		},
		//渲染完初始数据后执行
		mounted:function(){
			pullSwiper('#Main',true,true);
		}
	});
	
});


//下拉刷新
function refresh(pull){
	pull.innerHTML='刷新完成';
};

//上拉加载
function reload(pull){
	pull.innerHTML='已加载全部数据';
};
